package com.dfrz.ch09;

import java.util.Random;

/**
 * 作者：wangmaokang
 * 日期: 2021/4/19 16:13
 * 描述: 学生
 *
 */
public class Student {
    private String name;
    private int gender;
    private int age;
    private String className;
    private float height;
    private int total;  //每个对象消费总额

    public static int conTotal=0;//所有学生消费总额

    public void buyFun(){

        Random random=new Random();
        int i=random.nextInt(100);
        Student.conTotal+=i; //记录所有学生消费总额
        this.total+=i;
        System.out.println(this.name+"这次消费了"+i+"元，总共消费了"+this.total+"元");

    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public Student(String name, int gender, int age, String className, float height,int total) {
        this.name = name;
        this.gender = gender;
        this.age = age;
        this.className = className;
        this.height = height;
        this.total=total;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getGender() {
        return gender;
    }

    public void setGender(int gender) {
        this.gender = gender;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public float getHeight() {
        return height;
    }

    public void setHeight(float height) {
        this.height = height;
    }
}
